package cn.jbit.controller;

import cn.jbit.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;


/**
 * @author 张在成
 */
@RestController
@Slf4j
public class UserController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping(value = "/user/{orderId}")
    public Result getOrderInfoWithUser(@PathVariable("orderId") Integer orderId,String flag){

        System.out.println("网关添加请求过滤器参数："+flag);
        log.info("根据订单id查询订单信息："+orderId);
        Result result=restTemplate.getForObject("http://order-service/order/"+orderId, Result.class);


        return  result;
    }



}
